using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest2.Entitys
{
    /// <summary>
    /// 组件属性
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='组件属性']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class AppComponentAttr
    {
        /// <summary>
        /// attr_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary]
        public int AttrId { get; set; }

        /// <summary>
        /// component_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column]
        public int? ComponentId { get; set; }

        /// <summary>
        /// is_required
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(1, false)]
        public bool IsRequired { get; set; }

        [JsonConverter(typeof(AutoEnumConverter))]
        public AttrTypeEnum AttrTypeName => (AttrTypeEnum)AttrType;

        /// <summary>
        /// 属性类型 【文本,日期,图片,颜色,链接,文件,开关】
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '属性类型 【文本,日期,图片,颜色,链接,文件,开关】']]>
        /// </remarks>
        [Column(false)]
        [DisplayName("属性类型")]
        public int AttrType { get; set; }

        /// <summary>
        /// 属性名称
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '属性名称']]>
        /// </remarks>
        [Column(64)]
        [DisplayName("属性名称")]
        public string AttrName { get; set; }

        /// <summary>
        /// 属性字段
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '属性字段']]>
        /// </remarks>
        [Column(64)]
        [DisplayName("属性字段")]
        public string AttrField { get; set; }

        /// <summary>
        /// 映射字段
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '映射字段']]>
        /// </remarks>
        [Column(64)]
        [DisplayName("映射字段")]
        public string AttrMappingField { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '描述']]>
        /// </remarks>
        [Column(255)]
        [DisplayName("描述")]
        public string Placeholder { get; set; }

        /// <summary>
        /// sort
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(false)]
        public int Sort { get; set; }

    }
}
